$(document).ready(function() {
    //打印页面
    $('#print').click(function(event) {
        window.print();
    });

    //关闭窗口
    $('#close').click(function(event) {
        cof_alert('提示','确认关闭当前窗口吗？','确定','取消',function(){
            window.open('../../index.html','_parent'); 
        },function(){
            //
        }) 
    });

    if(!+[1,]){
        //ie浏览器
    }else{
        function fake_click(obj) {
            var ev = document.createEvent("MouseEvents");
            ev.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
            obj.dispatchEvent(ev);
        }
        function export_raw(name, data) {
            var urlObject = window.URL || window.webkitURL || window;
            var export_blob = new Blob([data]);
            var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
            save_link.href = urlObject.createObjectURL(export_blob);
            save_link.download = name;
            fake_click(save_link);
        }
        var test = document.getElementsByTagName('html')[0].outerHTML;
        $('#save').click(function() {
            export_raw('save.html', test);
        });
    }
});